<html>
<head>
    <script src="../resources/cross-frame-access.js"></script>
    <script>
        var openedWindow;

        window.onload = function()
        {
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.waitUntilDone();
                testRunner.setPopupBlockingEnabled(false);
            }

            var url = "javascript:\"<html><head><scr" + "ipt>window.onload = function() { window.opener.postMessage('run test', '*'); }</scr" + "ipt></head><body><p>Opened Frame</p><p id='accessMe'>FAIL</p></body></html>\"";
            openedWindow = window.open(url);

            window.addEventListener('message', function ()
            {
                runTest();
                closeWindowAndNotifyDone(openedWindow);
            });
        }

        runTest = function()
        {
            try {
                openedWindow.document.getElementById('accessMe').innerHTML = "PASS: Access to a window opened with a javascript: URL was allowed!";
                log("PASS: Access to a window opened with a javascript: URL was allowed!");
            } catch (e) {
                log("FAIL: Access to a window opened with a javascript: URL was denied.");
            }
        }
    </script>
</head>
<body>
    <p>Opener Frame</p>
    <pre id="console"></pre>
</body>
</html>
